|
accel23 2.2.0
|
API for configuring and manipulating Accel 23 Click driver. More...
Topics | |
| Accel 23 Registers List | |
| List of registers of Accel 23 Click driver. | |
| Accel 23 Registers Settings | |
| Settings for registers of Accel 23 Click driver. | |
| Accel 23 MikroBUS Map | |
| MikroBUS pin mapping of Accel 23 Click driver. | |
Functions | |
| void | accel23_cfg_setup (accel23_cfg_t *cfg) |
| Accel 23 configuration object setup function. | |
| void | accel23_drv_interface_sel (accel23_cfg_t *cfg, accel23_drv_t drv_sel) |
| Accel 23 driver interface setup function. | |
| err_t | accel23_init (accel23_t *ctx, accel23_cfg_t *cfg) |
| Accel 23 initialization function. | |
| err_t | accel23_default_cfg (accel23_t *ctx) |
| Accel 23 default configuration function. | |
| err_t | accel23_write_reg (accel23_t *ctx, uint8_t reg, uint8_t data_in) |
| Accel 23 write register function. | |
| err_t | accel23_write_regs (accel23_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| Accel 23 write registers function. | |
| err_t | accel23_read_reg (accel23_t *ctx, uint8_t reg, uint8_t *data_out) |
| Accel 23 read register function. | |
| err_t | accel23_read_regs (accel23_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| Accel 23 read registers function. | |
| void | accel23_set_eck_pin (accel23_t *ctx, uint8_t state) |
| Accel 23 set ECK pin function. | |
| uint8_t | accel23_get_it2_pin (accel23_t *ctx) |
| Accel 23 get IT2 pin function. | |
| err_t | accel23_check_communication (accel23_t *ctx) |
| Accel 23 check communication function. | |
| err_t | accel23_spi_wake_up (accel23_t *ctx) |
| Accel 23 SPI wake-up function. | |
| err_t | accel23_sw_reset (accel23_t *ctx) |
| Accel 23 software reset function. | |
| err_t | accel23_set_odr (accel23_t *ctx, uint8_t odr) |
| Accel 23 set output data rate function. | |
| err_t | accel23_set_fsr (accel23_t *ctx, uint8_t fsr) |
| Accel 23 set full-scale range function. | |
| err_t | accel23_check_accel_drdy (accel23_t *ctx) |
| Accel 23 check data ready function. | |
| err_t | accel23_get_accel (accel23_t *ctx, accel23_axes_t *accel) |
| Accel 23 get acceleration function. | |
| err_t | accel23_get_temp (accel23_t *ctx, float *temp) |
| Accel 23 get temperature function. | |
| err_t | accel23_get_data (accel23_t *ctx, accel23_data_t *data_out) |
| Accel 23 get all sensor data function. | |
API for configuring and manipulating Accel 23 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void accel23_cfg_setup | ( | accel23_cfg_t * | cfg | ) |
Accel 23 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See accel23_cfg_t object definition for detailed explanation. |
| err_t accel23_check_accel_drdy | ( | accel23_t * | ctx | ) |
Accel 23 check data ready function.
This function checks whether new acceleration data is available.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
0 - Data ready, -1 - Error. -2 - Not ready. | err_t accel23_check_communication | ( | accel23_t * | ctx | ) |
Accel 23 check communication function.
This function checks device communication by reading the WHO_AM_I register.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
0 - Communication OK, -1 - Communication Error. | err_t accel23_default_cfg | ( | accel23_t * | ctx | ) |
Accel 23 default configuration function.
This function executes a default configuration of Accel 23 Click board.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void accel23_drv_interface_sel | ( | accel23_cfg_t * | cfg, |
| accel23_drv_t | drv_sel ) |
Accel 23 driver interface setup function.
This function sets a serial driver interface which will be used further in the Click driver.
| [out] | cfg | : Click configuration structure. See accel23_cfg_t object definition for detailed explanation. |
| [in] | drv_sel | : Driver interface selection. See accel23_drv_t object definition for detailed explanation. |
| err_t accel23_get_accel | ( | accel23_t * | ctx, |
| accel23_axes_t * | accel ) |
Accel 23 get acceleration function.
This function reads and converts the X, Y, Z acceleration data.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [out] | accel | : Acceleration axes structure. See accel23_axes_t object definition. |
0 - Success, -1 - Error, -2 - Data not ready. | err_t accel23_get_data | ( | accel23_t * | ctx, |
| accel23_data_t * | data_out ) |
Accel 23 get all sensor data function.
This function retrieves acceleration and temperature data from the device.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [out] | data_out | : Output data structure containing both acceleration and temperature data. See accel23_data_t object definition. |
0 - Success, -1 - Error, -2 - Accel data not ready. | uint8_t accel23_get_it2_pin | ( | accel23_t * | ctx | ) |
Accel 23 get IT2 pin function.
This function returns the logic state of the IT2 pin.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| err_t accel23_get_temp | ( | accel23_t * | ctx, |
| float * | temp ) |
Accel 23 get temperature function.
This function reads and calculates the temperature value in Celsius.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [out] | temp | : Pointer to store temperature in Celsius. |
0 - Success, -1 - Error. | err_t accel23_init | ( | accel23_t * | ctx, |
| accel23_cfg_t * | cfg ) |
Accel 23 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See accel23_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t accel23_read_reg | ( | accel23_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
Accel 23 read register function.
This function reads a single byte of data from the selected register by using the communication interface.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Output data read from the register. |
0 - Success, -1 - Error. | err_t accel23_read_regs | ( | accel23_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
Accel 23 read registers function.
This function reads a sequence of bytes starting from the selected register by using the communication interface.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [out] | data_out | : Output data buffer. |
| [in] | len | : Number of bytes to read. |
0 - Success, -1 - Error. | void accel23_set_eck_pin | ( | accel23_t * | ctx, |
| uint8_t | state ) |
Accel 23 set ECK pin function.
This function sets the state of the ECK pin.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | state | : Pin state (0 or 1). |
| err_t accel23_set_fsr | ( | accel23_t * | ctx, |
| uint8_t | fsr ) |
Accel 23 set full-scale range function.
This function sets the full-scale measurement range.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | fsr | : Full-scale range value, see ACCEL23_FS_x macro definitions. |
0 - Success, -1 - Invalid FSR or Error. | err_t accel23_set_odr | ( | accel23_t * | ctx, |
| uint8_t | odr ) |
Accel 23 set output data rate function.
This function sets the output data rate (ODR) of the device.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | odr | : Output data rate setting, see ACCEL23_ODR_x macro definitions. |
0 - Success, -1 - Invalid ODR or Error. | err_t accel23_spi_wake_up | ( | accel23_t * | ctx | ) |
Accel 23 SPI wake-up function.
This function wakes up the device from software power-down mode.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t accel23_sw_reset | ( | accel23_t * | ctx | ) |
Accel 23 software reset function.
This function performs a software reset by setting the SW_RESET bit in the control register.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t accel23_write_reg | ( | accel23_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
Accel 23 write register function.
This function writes a single byte of data to the selected register by using the communication interface.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data to be written. |
0 - Success, -1 - Error. | err_t accel23_write_regs | ( | accel23_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
Accel 23 write registers function.
This function writes a sequence of bytes starting from the selected register by using the communication interface.
| [in] | ctx | : Click context object. See accel23_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [in] | data_in | : Data buffer to be written. |
| [in] | len | : Number of bytes to write. |
0 - Success, -1 - Error.